<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/btn.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/paging.css">
<script type="text/javascript" src="${pageContext.request.contextPath }/js/validate.js"></script>
<style type="text/css">
.rowClickBg{
	background-color: #CBC9C9;
}
</style>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.9.1.js"></script>
  <script type="text/javascript">
  	$(function(){
  		$("tr.data").click(function(){
  			$(this).siblings().removeClass("rowClickBg");
  			$(this).toggleClass("rowClickBg");
  			//return window.confirm("确认要删除"+this.name+"?");
  		});
  		$(".del").click(function(){
  			var id = $("tr.rowClickBg input[name='id']").val();
  			if(id){
	  			if(window.confirm("确认要删除吗？")){
	  				$(".del a").attr("href","${pageContext.request.contextPath}/inWearOrder/delete?id="+id);
	  				return true;
	  			}
  			}else{
  				alert("请选择一条数据！");
  			}
  			return false;
  		});
  		$("#firstPage").click(function(){
  			$("input[name='pageNo']").val(1);
  			$("form").submit();
  		});
  		$("#prevPage").click(function(){
  			$("input[name='pageNo']").val(${pageInfo.currentPage}-1);
  			$("form").submit();
  		});
  		$("#nextPage").click(function(){
  			$("input[name='pageNo']").val(${pageInfo.currentPage}+1);
  			$("form").submit();
  		});
  		$("#lastPage").click(function(){
  			$("input[name='pageNo']").val(${pageInfo.totalPage});
  			$("form").submit();
  		});
  		pagingValidate=function(){
  			var val = $("input[name='pageNo']").val();
 			var re = /^[0-9]\d*$/;
 			if(!re.test(val)){
 				$("input[name='pageNo']").val(1);
 			}
 			submit();
  		};
  		submit=function(){
  			$("form").submit();
  		};
  	});
  </script>
  <style type="text/css">
  	tr th{
  		width: 12%;
  	}
  </style>
  </head>
  
  <body>
  	<span class="path">&gt;进货列表</span><br><br>
  	
  	<div class="btn add"><a href="${pageContext.request.contextPath}/inWearOrder/showAdd">进货</a></div>
  	<div class="btn del"><a href="${pageContext.request.contextPath}/inWearOrder/delete">作废</a></div>
  	<br><br>
  	
  	<form action="${pageContext.request.contextPath}/inWearOrder/listAll" method="post">
		<div style="height: 700px;">
		  	<div class="btn add" style="float: right;margin-left: 10px;margin-bottom: 10px;"><a href="#" onclick="submit()">查询</a></div>
		  	<div style="text-align: right;">
		  	衣服编码：<input type="text" style="width: 130px;" name="wearCode" value="${param.wearCode }">
 		</div>
  	
  	<center>
    <table class="list" border="1px" width="100%" cellpadding="2" cellspacing="0">
    <tr>
    	<th>衣服编码</th>
    	<th>衣服类别</th>
    	<th>码数</th>
    	<th>进货日期</th>
    	<th>进货数量</th>
    	<th>进价</th>
    	<th>本次总进价</th>
    </tr>
    <c:forEach var="inWearOrder" items="${list }">
    	 <tr class="data">	
	    	<td>${inWearOrder.wearCode }</td>
	    	<td>${inWearOrder.wearType }</td>
	    	<td class="right">${inWearOrder.wearSize }</td>
	    	<td class="right">${inWearOrder.inWearDate }</td>
	    	<td class="right">${inWearOrder.inNumber }</td>
	    	<td class="right">${inWearOrder.inPrice }</td>
	    	<td class="right">${inWearOrder.inPriceSum }</td>
	    	<input type="hidden" name="id" value="${inWearOrder.id }"/>
	    	<input type="hidden" name="wearId" value="${inWearOrder.wearId }"/>
  		 </tr>
    </c:forEach>
    </table>
  	</center>
  	
  	<div class="paging">
	    	<span>共${pageInfo.totalRecord }条记录&nbsp;&nbsp;第${pageInfo.currentPage }页 共${pageInfo.totalPage }页</span>
		    <div id="firstPage">首页</div>
		    <c:if test="${pageInfo.currentPage>1 }">
			    <div id="prevPage">上页</div>
		    </c:if>
		    <c:if test="${pageInfo.currentPage!=pageInfo.totalPage }">
			    <div id="nextPage">下页</div>
		    </c:if>
		    <div id="lastPage">末页</div>
		    <input type="text" style="width: 30px;margin-left: 10px;" class="int" name="pageNo" onblur="pagingValidate()"/>&nbsp;页
	    </div>
    </div>
    </form>
    
   
  </body>
  
</html>